{-# LANGUAGE BinaryLiterals #-}

module EqClasses
  ( BasicEq3,
    isEqual3,
  )
where

-- file: ch06/eqclasses.hs
class BasicEq a where
  isEqual :: a -> a -> Bool

-- file: ch06/eqclasses.hs
instance BasicEq Bool where
  isEqual True True = True
  isEqual False False = True
  isEqual _ _ = False

-- file: ch06/eqclasses.hs
class BasicEq3 a where
  isEqual3 :: a -> a -> Bool
  isEqual3 x y = not (isNotEqual3 x y)

  isNotEqual3 :: a -> a -> Bool
  isNotEqual3 x y = not (isEqual3 x y)

-- file: ch06/eqclasses.hs
instance BasicEq3 Bool where
  isEqual3 False False = True
  isEqual3 True True = True
  isEqual3 _ _ = False